﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Business_Layer;
using System.Drawing;

namespace Control_Layer
{
    public class Service
    {
        private static Service uniqueInstance;
        private Project project;

        private CCSelectComponent ccSelectComponent;

        private Service()
        {
            project = new Project();
            ccSelectComponent = new CCSelectComponent(this);
        }

        /// <summary>
        /// Create a unique instance.
        /// </summary>
        public static Service GetInstance
        {
            get
            {
                if (uniqueInstance == null) 
                    uniqueInstance = new Service();
                return uniqueInstance;
            }
        }

        /// <summary>
        /// Get or set the project instance.
        /// </summary>
        public Project GetProject
        {
            get { return project; }
            set { project = value; }
        }

        /// <summary>
        /// Get a unique selection instance.
        /// </summary>
        public CCSelectComponent GetCCSelectComponent
        {
            get { return ccSelectComponent; }
        }

        /// <summary>
        /// Update the bitmap screen.
        /// </summary>
        /// <returns></returns>
        public Bitmap UpdateScreen()
        {
            return project.ShowMindmap();
        }

        /// <summary>
        /// Save the project.
        /// </summary>
        public void SaveProject()
        {
            //Saving should be added later
            project = new Project();
            ccSelectComponent = new CCSelectComponent(this);
        }
    }
}
